#!/bin/bash
# Usage: make module name=... [namespace=...]

MODULEDIR="$1"
NAMESPACE="$2"

if [ "$MODULEDIR" = "" -o "$NAMESPACE" = "" ]; then
    echo "Usage: make module name=... [namespace=...]"
    exit 1
fi

if [ -e "$MODULEDIR" ]; then
    echo "Directory $MODULEDIR already exists. Exit."
    exit 1
fi

mkdir $MODULEDIR
mkdir $MODULEDIR/css
mkdir $MODULEDIR/i18n
mkdir $MODULEDIR/img
mkdir $MODULEDIR/js
mkdir $MODULEDIR/tmpl

echo "{
    \"namespace\": \"$NAMESPACE\",
    \"dependencies\": [ \"boot\" ],
    \"sources\": [],
    \"styles\": [],
    \"statics\": []
}" > "$MODULEDIR/manifest.json"

echo "require \"lemonade\"

http_path = \"/\"
css_dir = \"scss\"
sass_dir = \"scss\"
images_dir = \"img\"
javascripts_dir = \"js\"
relative_assets = false
asset_cache_buster :none" > "$MODULEDIR/config.rb"
